package com.googlecode.java_cl_parser;

import junit.framework.Assert;
import org.junit.Test;

@CLIEntry(
		description = "",
		version = "1.0"
)
public class OptionAssignmentOrder
{
	private String order = "";

	@CLIOption(
			name = "a",
			defaultValue = "1"
	)
	public void setA(int count)
	{
		order += "a";
	}

	@CLIOption(
			name = "b",
			defaultValue = "1"
	)
	public void setB(int count)
	{
		order += "b";
	}

	@CLIOption(
			name = "c",
			defaultValue = "1"
	)
	public void setC(int count)
	{
		order += "c";
	}

	@CLIOption(
			name = "d",
			defaultValue = "1"
	)
	public void setD(int count)
	{
		order += "d";
	}

	@CLIOption(
			name = "e",
			defaultValue = "1"
	)
	public void setE(int count)
	{
		order += "e";
	}

	@CLIOption(
			name = "f",
			defaultValue = "1"
	)
	public void setF(int count)
	{
		order += "f";
	}

	@CLIOption(
			name = "g",
			defaultValue = "1"
	)
	public void setG(int count)
	{
		order += "g";
	}

	@CLIOption(
			name = "h",
			defaultValue = "1"
	)
	public void setH(int count)
	{
		order += "h";
	}

	@CLIOption(
			name = "i",
			defaultValue = "1"
	)
	public void setI(int count)
	{
		order += "i";
	}

	@CLIOption(
			name = "j",
			defaultValue = "1"
	)
	public void setJ(int count)
	{
		order += "j";
	}

	@Test
	public void optionsAssignedInDeclarationOrderImplicit() throws Exception
	{
		OptionAssignmentOrder basicTest = new OptionAssignmentOrder();
		CommonsCLILauncher.mainWithInstance(basicTest, new String[]{});
		Assert.assertEquals("abcdefghij", basicTest.order);
	}

	@Test
	public void optionsAssignedInDeclarationOrderRegardlessOfCL() throws Exception
	{
		OptionAssignmentOrder basicTest = new OptionAssignmentOrder();
		CommonsCLILauncher.mainWithInstance(basicTest, new String[]{"-j", "1", "-a", "1"});
		Assert.assertEquals("abcdefghij", basicTest.order);
	}
}